package com.lft01.thread;

/**
 * Function: ADD FUNCTION. Reason: ADD REASON. Date 2020/6/5 15:49
 *
 * <p>Class Name: MyTicket Package Name: com.lft.thread
 *
 * @author Laifengting
 * @version 1.0.0
 * @since JDK 8
 */
public class MyTicket {
	public static int num = 10;
	
	public synchronized void sale() {
		num--;
		System.out.println(Thread.currentThread().getName() + "卖出一张票，剩余票数：" + num);
	}
	
	public static int getNum() {
		return num;
	}
	
	public static void setNum(int num) {
		MyTicket.num = num;
	}
}
